package Thread;
/*使用匿名内部类的形式完成线程的两种创建*/
public class ThreadDemo3 {
    public static void main(String[] args) {
        Thread t1=new MyThread(){
            public void run(){
                for (int i=0;i<1000;i++){
                    System.out.println("你是谁啊");
                }

            }
        } ;

       /* Runnable r2=new Runnable() {
            @Override
            public void run() {
                for (int i=0;i<1000;i++){
                    System.out.println("woshi ");
                }
            }
        } ;*/

        /*Runnable r2= () -> {
            for (int i=0;i<1000;i++){
                System.out.println("woshi ");
            }
        };*/
        //Runnable可以使用lambda表达式创建
        Thread t2=new Thread(() -> {
            for (int i=0;i<1000;i++){
                System.out.println("woshi ");
            }
        });
        t1.start();
        t2.start();
    }
}
class MyThread extends Thread{
    public void run(){
        System.out.println(

        );
    }

}
